<template>
  <NavCustom title="地址列表" />
  <van-address-list
    v-model="address.choosenId"
    :list="address.list"
    default-tag-text="默认"
    @add="onAdd"
    @edit="onEdit"
  />
  <van-popup v-model:show="show" position="bottom" :style="{ height: '60%' }">
    <AddressAdd @hide-popup="show = false" />
  </van-popup>
</template>

<script setup lang="ts">
import NavCustom from "../../components/nav-custom.vue";
import { ref } from "vue";
import { showToast } from "vant";
import { useAddress } from "../../store/address";
import AddressAdd from "./add.vue";
const address = useAddress();
const onAdd = () => {
  address.editIdx = -1;
  show.value = true;
};
const onEdit = (item: any, index: number) => {
  address.editIdx = index;
  show.value = true;
};
const show = ref<boolean>(false);
</script>

<style scoped></style>
